﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;


namespace LocationAwareness
{
    /// <summary>
    /// This class is an objectiv represantation
    /// of the choosen settings 
    /// </summary>
    [XmlRootAttribute("Settings",IsNullable=false)]
    public class Settings
    {
        /// <summary>
        /// Default constructor
        /// </summary>
        public Settings()
        {
            DefaultFilter = new Dictionary<string, bool>();
            serviceUrl = "http://192.168.0.102/locawa/index.php?lat={0}&long={1}";
            showButtons = true;
            update = 0;
        }

        [XmlElementAttribute(IsNullable = false)]
        private uint update;

        /// <summary>
        /// Refresh cycle of the webbrowser:
        /// 0 = update manual; 1-99 = update automatically all 1-99 sec
        /// </summary>
        public uint Update
        {
            get
            {
                return update;
            }

            set
            {
                update = value;
            }
        }

        [XmlElementAttribute(IsNullable = false)]
        private bool showButtons;

        /// <summary>
        /// Show quickfilter buttons on GUI or not
        /// </summary>
        public bool ShowButtons
        {
            get
            {
                return showButtons;
            }

            set
            {
                showButtons = value;
            }
        }

        [XmlElementAttribute(IsNullable = false)]
        private String serviceUrl;

        /// <summary>
        /// Specifies the url of the service the application connects to.
        /// </summary>
        public String ServiceUrl
        {
            get
            {
                return serviceUrl;
            }

            set
            {
                serviceUrl = value;
            }
        }

        [XmlElementAttribute(IsNullable = false)]
        private String defaultFile;

        /// <summary>
        /// Specifies the file on the webserver the application connects to for the default view.
        /// </summary>
        public String DefaultFile
        {
            get
            {
                return defaultFile;
            }

            set
            {
                defaultFile = value;
            }
        }

        [XmlElementAttribute(IsNullable = false)]
        private String detailFile;

        /// <summary>
        /// Specifies the file on the webserver the application connects to for the detail view.
        /// </summary>
        public String DetailFile
        {
            get
            {
                return detailFile;
            }

            set
            {
                detailFile = value;
            }
        }

        [XmlElementAttribute(IsNullable = false)]
        private String updateDetailFile;

        /// <summary>
        /// Specifies the file on the webserver the application connects to for the detail view.
        /// </summary>
        public String UpdateDetailFile
        {
            get
            {
                return updateDetailFile;
            }

            set
            {
                updateDetailFile = value;
            }
        }

        /// <summary>
        /// List of the categories for the filter
        /// </summary>
        [XmlElementAttribute(IsNullable = false)]
        public Dictionary<string, bool> DefaultFilter;


        /// <summary>
        /// Maximal distance to a POI
        /// </summary>
        [XmlElementAttribute(IsNullable = false)]
        private string distanceToPoi;

        public string DistanceToPoi
        {
            get
            {
                return distanceToPoi;
            }

            set
            {
                distanceToPoi = value;
            }
        }

    }
}
